package service.StrategyService._stub;

import java.rmi.RemoteException;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

import VO.StrategyVO;
import service.StrategyService.HotelStrategyService;
import util.Message;
import util.UserType;

public class HotelStrategyService_stub implements HotelStrategyService {



	 public HotelStrategyService_stub() throws RemoteException {
	        super();
	    }

	    public Iterator<StrategyVO> getStrategy(String hotelid) throws RemoteException{
	        List<StrategyVO> list= new ArrayList<StrategyVO>();
	        StrategyVO strategyVO=new StrategyVO("insomnia",UserType.CLIENT,"1元可住",30);
	        list.add(strategyVO);
	        Iterator<StrategyVO> iter=list.iterator();
	        return  iter;
	    }

	    public Message addNewStrategy(StrategyVO strategyVO)throws RemoteException {
	        StrategyVO newStrategyVO=strategyVO.getStrategyVO();
	       if (newStrategyVO.getContent()==null||newStrategyVO.getDiscount()<=0){
	            return Message.NOT_COMPLETE;
	        }else if(newStrategyVO.getUserType()==UserType.HOTELSTAFF||newStrategyVO.getUserType()==UserType.WEBSITEMARKERER){
	            return Message.SUCCESS;
	        }else{
	            return Message.FAIL;
	        }
	    }

	    public boolean removeStrategy(StrategyVO strategyVO) throws RemoteException{
	        if (strategyVO!=null){
	            return true;
	        }else{
	            return false;
	        }
	    }
}
